package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ClassInformation;
import cn.wolfcode.crm.domain.Employee;
import cn.wolfcode.crm.mapper.ClassInformationMapper;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.IClassInfomationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassInfomationServiceImpl implements IClassInfomationService {

    @Autowired
    private ClassInformationMapper classInformationMapper;


    @Override
    public void deleteByPrimaryKey(Long id) {
        classInformationMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insert(ClassInformation record) {
        classInformationMapper.insert(record);
    }

    @Override
    public ClassInformation selectByPrimaryKey(Long id) {
        return classInformationMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ClassInformation> selectAll() {
        return classInformationMapper.selectAll();
    }

    @Override
    public void updateByPrimaryKey(ClassInformation record) {
        classInformationMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<ClassInformation> query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<ClassInformation> classInformations = classInformationMapper.query(qo);
        return new PageInfo<ClassInformation>(classInformations);
    }

    @Override
    public List<Employee> selectAllTeacherName() {
        return classInformationMapper.selectAllTeacherName();
    }
}
